package cn.ac.iie.kgmanager.domain;

import lombok.Data;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * @ClassName Graph
 * @Author tjh
 * @Date 19/6/12 上午10:12
 * @Version 1.0
 **/
@Data
public class Graph {
    private Set<Node> nodes;
    private Set<Relation> relations;

    public void addNodes(Node... nodes) {
        if(this.nodes == null) {
            this.nodes = new HashSet<>();
        }

        this.nodes.addAll(Arrays.asList(nodes));
    }

    public void addRelations(Relation... relations) {
        if(this.relations == null) {
            this.relations = new HashSet<>();
        }

        this.relations.addAll(Arrays.asList(relations));
    }
}
